package com.situ.day25.singleton;

// 懒汉式单例 - 内部类
public class Singleton5 {
    //static Singleton5 INSTANCE = new Singleton5();

    private Singleton5() {
    }

    //没有用到这个静态内部类不会触发他的加载、连接、初始化，也就不会初始化对象
    private static class Holder {
        static Singleton5 INSTANCE = new Singleton5();
    }

    public static Singleton5 getInstance() {
        return Holder.INSTANCE;
    }
}
